<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>

<script src="${base}/js/crytojs/components/core.js"></script>


<script>
    // Hex encrypt   16进制加密
    var word2 ="中国hello world!/+=";
    var word2Array = CryptoJS.enc.Utf8.parse(word2);
    var encryptedHexStr = CryptoJS.enc.Hex.stringify(word2Array);
    console.log('CryptoJS.enc.Hex = ', encryptedHexStr);
    
    // Hex decrypt  16进制解密
    var hexWord2Array = CryptoJS.enc.Hex.parse(encryptedHexStr);
    var parsedStr = CryptoJS.enc.Utf8.stringify(hexWord2Array);;
    console.log('CryptoJS.Dec.Hex = ', parsedStr);
    
    
    function encode(word){
        var wordArray = CryptoJS.enc.Utf8.parse(word);
        var encryptedHexStr = CryptoJS.enc.Hex.stringify(wordArray);
        return encryptedHexStr;
    }
    
    function decode(encryptedHexStr){
        var hexWord2Array = CryptoJS.enc.Hex.parse(encryptedHexStr);
        var parsedStr = CryptoJS.enc.Utf8.stringify(hexWord2Array);
        return parsedStr;
    }
    

	function decodeBack(){
		var keyword = encode("https://www.baidu.com/+=");
		window.open("${base}/crytoHex/decode?keyword="+keyword);
	}
</script>    
</head>
<body>
 <h1>F12请看console</h1>
 <input  type="button"   onclick="decodeBack()"  value="后端解密">
</body>
</html>